import { Application } from 'egg';

export default (app:Application) => {
  const { controller, router } = app;
  const apiV1Router = router.namespace('/api/v1');

  apiV1Router.get('/', controller.home.index);

  /**
     * 用户注册
     */
  apiV1Router.post('/user/register', controller.user.register);

  /**
     * 用户登录
     */
  apiV1Router.post('/user/login', controller.user.login);

  /**
   * 获取验证码
   */
  apiV1Router.get('/user/captcha', controller.user.captcha);

  /**
     * 用户退出登录
     */
  apiV1Router.post('/user/logout', controller.user.logout);

  /**
     * 通过token获取用户信息
     */
  apiV1Router.get('/user/getUserInfo', controller.user.getUserInfo);

  /**
     * 获取用户列表
     */
  apiV1Router.get('/user/getUserList', controller.user.getUserList);

  /**
     * 修改用户信息
     */
  apiV1Router.post('/user/getUserUpdate', controller.user.getUserUpdate);

  /**
     * 删除用户
     */
  apiV1Router.post('/user/delUser', controller.user.delUser);
};
